#!/usr/bin/env bash

#清空所有目录
rm -rf /data/nfs/mysql-master/*
rm -rf /data/nfs/mysql-slaver-01/*
rm -rf /data/nfs/mysql-slaver-02/*
rm -rf /data/nfs/mysql-slaver-03/*


#创建nfs存储文件
mkdir -p /data/nfs/{mysql-master,mysql-slaver-01,mysql-slaver-02,mysql-slaver-03}
cat >> /etc/exports << EOF
/data/nfs/mysql-master *(rw,sync,no_root_squash)
/data/nfs/mysql-slaver-01 *(rw,sync,no_root_squash)
/data/nfs/mysql-slaver-02 *(rw,sync,no_root_squash)
/data/nfs/mysql-slaver-03 *(rw,sync,no_root_squash)
EOF

systemctl restart nfs-server
systemctl enable --now nfs-server

